﻿@using System.Globalization;
@model System.Collections.IEnumerable
@{
    Layout = "~/Views/Shared/_Dashboard.cshtml";
    var _context = WebSiteContext.Current;
}
@UIHelper.ImageTitle(Html.Global("RES_TRANSLATOR"), Html.Global("Translator_Desc"), "~/content/images/icon_translate_48.png")
@UIHelper.SectionHeader(Html.Global("Translator_SelectBaseLanguage"))
<div class="d-field-description">@Html.Global("Translator_SelectBaseLanguage_Tips")</div>
<table style="padding: 10px 0px 10px 0px;">
    <tr>
        <td>
            <label for="cbLanguages">
                @Html.Global("Translator_BaseLanguage"):</label>
        </td>
        <td>@Ajax.Dna().ComboBox("cbLanguages").DropDownList().Bind(_context.Languages).Select(_context.Language).GetHtml()
        </td>
        @*<td>@Ajax.Dna().Button("btnDownload").ChangeType(ButtonTypes.LinkButton).LocText("RES_DOWNLOAD").Click("window.open(\"" + Url.Action("DownloadLanguage") + "?lang=\"+$(\"#cbLanguages\").val());").GetHtml()
        </td>*@
    </tr>
</table>
@UIHelper.SectionHeader(Html.Global("Translator_SelectTargetLanguage"))
<div class="d-field-description">@Html.Global("Translator_SelectTargetLanguage_Tips")</div>
<cite>@Html.Global("Translator_notes")</cite>
<table style="padding: 10px 0px 10px 0px;">
    <tr>
        <td>
            <label for="cbLanguages">
                @Html.Global("Translator_TargetLanguage"):</label>
        </td>
        <td>@(Ajax.DnaFor().ComboBox<CultureInfo>(CultureInfo.GetCultures(CultureTypes.SpecificCultures))
        .DataTextField(m => m.DisplayName)
        .DataValueField(m => m.Name)
        .DropDownList()
        .Name("cbCulture")
        .GetHtml())
        </td>
        <td>
        </td>
    </tr>
</table>
@UIHelper.SectionHeader(Html.Global("Translator_EnableBing"))
<div class="d-field-description">@MvcHtmlString.Create(Html.Global("Translator_EnableBing_Tips"))</div>
@using (Html.BeginForm())
{
    <table style="padding: 10px 0px 10px 0px;">
        <tr>
            <td>
                <label for="appId">
                    @Html.Global("RES_BING_APPID"):</label>
            </td>
            <td>
                @Ajax.Dna().TextBox("BingAppID").Value(!string.IsNullOrEmpty(ViewBag.BingID) ? ViewBag.BingID : "" ).GetHtml()
            </td>
            <td>@Ajax.Dna().Button().LocText("RES_SAVE").Submit().GetHtml()
            </td>
        </tr>
    </table>
}
@UIHelper.SectionHeader(Html.Global("Translator_SelectTargetLanguageFile"))
<div class="d-field-description">@Html.Global("Translator_SelectTargetLanguageFile_Tips")
    <ul>
        <li>language - @Html.Global("Translator_language")</li>
        <li>forums - @Html.Global("Translator_forums")</li>
        <li>publishing - @Html.Global("Translator_publishing")</li>
    </ul>
</div>
<table style="padding: 10px 0px 10px 0px;">
    <tr>
        <td>
            <label for="cbLanguages">
                @Html.Global("Translator_TargetResources"):</label>
        </td>
        <td>
            @{
                var resxs = System.IO.Directory.GetDirectories(Server.MapPath("~/App_GlobalResources")).Select(v => (new DirectoryInfo(v)).Name).ToArray();
            }
            @Ajax.Dna().ComboBox("cbResources").DropDownList().Bind(resxs).Select("language").GetHtml()
        </td>
        <td>
            @Ajax.Dna().Button("btnTranslate").LocText("RES_TRANSLATE").Click("location=\"" + Url.Action("LabelEditor", "Sys") + "?res=\"+$('#cbResources').val()+\"&from=\"+$('#cbLanguages').val()+\"&to=\"+$('#cbCulture').val();").GetHtml()
        </td>
    </tr>
</table>
